package top.hzy520.Controller;

import top.hzy520.dto.UserStateDto;
import top.hzy520.entity.User;
import top.hzy520.entity.UserState;
import top.hzy520.service.UserStateServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

public class UserStateServlet extends HttpServlet {
    UserStateServiceImpl userStateService=new UserStateServiceImpl();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        User user= (User) request.getSession().getAttribute("user");
        List<UserStateDto> userStateList=userStateService.findUserstateByUserid(user.getId());
        request.setAttribute("userstatelist",userStateList);
        request.getRequestDispatcher("/userstate.jsp").forward(request,response);
    }
}
